webpackJsonp([33],{

/***/ "2zj3":
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ }),

/***/ "Lu4L":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/core-js/promise.js
var promise = __webpack_require__("rVsN");
var promise_default = /*#__PURE__*/__webpack_require__.n(promise);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__("KH7x");
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/regenerator/index.js
var regenerator = __webpack_require__("lC5x");
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__("J0Oq");
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/extends.js
var helpers_extends = __webpack_require__("4YfN");
var extends_default = /*#__PURE__*/__webpack_require__.n(helpers_extends);

// EXTERNAL MODULE: ./src/store/index.js
var store = __webpack_require__("IcnI");

// EXTERNAL MODULE: ./src/common/utils/index.js
var utils = __webpack_require__("dh3M");

// EXTERNAL MODULE: ./src/common/api/commonApi.js
var commonApi = __webpack_require__("+/+p");

// EXTERNAL MODULE: ./src/common/plugin/index.js + 207 modules
var common_plugin = __webpack_require__("Tvds");

// CONCATENATED MODULE: ./node_modules/_babel-loader@7.1.5@babel-loader/lib!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=script&index=0!./src/common/anjian/law/programme.vue





//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//






/* harmony default export */ var programme = ({
  data: function data() {
    return {
      form: {
        check_time: ''
      },
      userList: [],
      modeList: []
    };
  },
  activated: function activated() {
    if (!this.$router.$isBack) {
      this.init();
      this.fetchData();
    }
  },
  created: function created() {
    var _this = this;

    store["a" /* BUS */].$on(store["b" /* EVENTS */].lawProgrammeContent, function (list) {
      var check_content = list.map(function (v, index) {
        return index + 1 + ' : ' + v + '\u3002\n';
      }).join('');
      _this.form = extends_default()({}, _this.form, { check_content: check_content });
      setTimeout(function () {
        _this.$refs.input.updateAutosize();
      }, 30);
    });
  },

  methods: {
    onPreview: function onPreview(loaded) {
      var _this2 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee() {
        var word, _ref, url;

        return regenerator_default.a.wrap(function _callee$(_context) {
          while (1) {
            switch (_context.prev = _context.next) {
              case 0:
                _context.prev = 0;
                _context.next = 3;
                return commonApi["a" /* commonApi */].runCloud('officeCopy', {
                  code: 'D0001',
                  data: _this2.$route.query.id
                });

              case 3:
                word = _context.sent;
                _context.next = 6;
                return commonApi["a" /* commonApi */].runCloud('WordToPdf', { word: word });

              case 6:
                _ref = _context.sent;
                url = _ref.url;

                if (url) {
                  _context.next = 12;
                  break;
                }

                _this2.$Toast('文件转换失败，请尝试重新预览！', 'error');
                loaded();
                return _context.abrupt('return');

              case 12:
                common_plugin["b" /* bridge */].PreviewPdf({ title: '文件标题', url: url });
                _context.next = 17;
                break;

              case 15:
                _context.prev = 15;
                _context.t0 = _context['catch'](0);

              case 17:
                loaded();

              case 18:
              case 'end':
                return _context.stop();
            }
          }
        }, _callee, _this2, [[0, 15]]);
      }))();
    },
    goContent: function goContent() {
      this.$router.$push('/law/programmeContent');
    },
    init: function init() {
      var _this3 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee2() {
        var form, _ref2, D0001;

        return regenerator_default.a.wrap(function _callee2$(_context2) {
          while (1) {
            switch (_context2.prev = _context2.next) {
              case 0:
                _this3.programme = _this3.$route.query.programme;
                _context2.next = 3;
                return commonApi["a" /* commonApi */].searchById('law_programme', _this3.programme, {
                  include: ['enterprise_id']
                });

              case 3:
                form = _context2.sent;

                _this3.form = Object(utils["c" /* PointerToString */])(form, ['check_person:array']);

                if (!_this3.form.document_num) {
                  _context2.next = 7;
                  break;
                }

                return _context2.abrupt('return');

              case 7:
                _context2.next = 9;
                return commonApi["a" /* commonApi */].runCloud('lawGetDocumentNum', {
                  year: new Date().getFullYear()
                });

              case 9:
                _ref2 = _context2.sent;
                D0001 = _ref2.D0001;

                _this3.form = extends_default()({}, _this3.form, { document_num: D0001 });

              case 12:
              case 'end':
                return _context2.stop();
            }
          }
        }, _callee2, _this3);
      }))();
    },
    fetchData: function fetchData() {
      var _this4 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee3() {
        var p, _ref3, _ref4, userList, modeList;

        return regenerator_default.a.wrap(function _callee3$(_context3) {
          while (1) {
            switch (_context3.prev = _context3.next) {
              case 0:
                p = [commonApi["a" /* commonApi */].search('aj_organization_personnel', {
                  include: ['OrganizationIds'],
                  matchesQuery: {
                    OrganizationIds: commonApi["a" /* commonApi */].createQueryIncludeOptions('sys_organizations', {
                      equalTo: {
                        Name: '安监局执法'
                      }
                    })
                  }
                }), commonApi["a" /* commonApi */].dictionary('check_mode')];
                _context3.next = 3;
                return promise_default.a.all(p);

              case 3:
                _ref3 = _context3.sent;
                _ref4 = slicedToArray_default()(_ref3, 2);
                userList = _ref4[0];
                modeList = _ref4[1];

                _this4.userList = userList;
                _this4.modeList = modeList;

              case 9:
              case 'end':
                return _context3.stop();
            }
          }
        }, _callee3, _this4);
      }))();
    },
    onSubmit: function onSubmit(loaded) {
      var _this5 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee4() {
        var form;
        return regenerator_default.a.wrap(function _callee4$(_context4) {
          while (1) {
            switch (_context4.prev = _context4.next) {
              case 0:
                _context4.prev = 0;
                form = Object(utils["a" /* BuildPointer */])(_this5.form, {
                  check_person: 'aj_organization_personnel'
                });

                if (form.state !== 1) {
                  form.state = 1;
                  form.auditState = 0;
                }
                _context4.next = 5;
                return commonApi["a" /* commonApi */].save('law_programme', form);

              case 5:
                _this5.$router.$back();
                _this5.$Toast('新增成功!', 'success');
                _context4.next = 12;
                break;

              case 9:
                _context4.prev = 9;
                _context4.t0 = _context4['catch'](0);

                _this5.$Toast('新增失败!', 'error');

              case 12:
                loaded();

              case 13:
              case 'end':
                return _context4.stop();
            }
          }
        }, _callee4, _this5, [[0, 9]]);
      }))();
    }
  }
});
// CONCATENATED MODULE: ./node_modules/_vue-loader@13.7.3@vue-loader/lib/template-compiler?{"id":"data-v-782720ca","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=template&index=0!./src/common/anjian/law/programme.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('yt-page',{attrs:{"title":"现场检查方案"}},[_c('yt-form',[_c('yt-cell',{attrs:{"label":"文书编号","value":_vm.form.document_num}}),_vm._v(" "),_c('yt-cell',{attrs:{"label":"被检查企业","value":_vm.form.enterprise_id ? _vm.form.enterprise_id.attributes.EnterpriseName : ''}}),_vm._v(" "),_c('yt-cell',{attrs:{"label":"检查时间"}},[_c('yt-cell-time',{model:{value:(_vm.form.check_time),callback:function ($$v) {_vm.$set(_vm.form, "check_time", $$v)},expression:"form.check_time"}})],1),_vm._v(" "),_c('yt-cell',{attrs:{"label":"检查人员"}},[_c('yt-cell-select',{attrs:{"max":5,"list":_vm.userList,"label":"DisplayName","val":"id"},model:{value:(_vm.form.check_person),callback:function ($$v) {_vm.$set(_vm.form, "check_person", $$v)},expression:"form.check_person"}})],1),_vm._v(" "),_c('yt-cell',{attrs:{"label":"检查方式"}},[_c('yt-cell-select',{attrs:{"max":3,"list":_vm.modeList,"label":"D_text","val":"D_code"},model:{value:(_vm.form.check_mode),callback:function ($$v) {_vm.$set(_vm.form, "check_mode", $$v)},expression:"form.check_mode"}})],1),_vm._v(" "),_c('yt-cell',{attrs:{"label":"检查内容","value":"添加","border":"none","isLink":""},on:{"click":_vm.goContent}}),_vm._v(" "),_c('yt-textarea',{ref:"input",staticClass:"input",attrs:{"type":"column"},model:{value:(_vm.form.check_content),callback:function ($$v) {_vm.$set(_vm.form, "check_content", $$v)},expression:"form.check_content"}}),_vm._v(" "),(_vm.form.state === 0)?_c('yt-btn',{attrs:{"slot":"btn","loading":_vm.onSubmit,"theme":"blue","edge":""},slot:"btn"},[_vm._v("保存")]):_c('yt-btn-group',{attrs:{"slot":"btn","shadow":false,"edge":""},slot:"btn"},[_c('yt-btn',{attrs:{"theme":"white","loading":_vm.onSubmit,"loadingOption":{color: '#46baff'}}},[_vm._v("保存")]),_vm._v(" "),_c('yt-btn',{attrs:{"theme":"white","loading":_vm.onPreview,"loadingOption":{color: '#46baff'}}},[_vm._v("预览文书")])],1)],1)],1)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var law_programme = (esExports);
// CONCATENATED MODULE: ./src/common/anjian/law/programme.vue
function injectStyle (ssrContext) {
  __webpack_require__("2zj3")
}
var normalizeComponent = __webpack_require__("C7Lr")
/* script */


/* template */

/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-782720ca"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  programme,
  law_programme,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

/* harmony default export */ var anjian_law_programme = __webpack_exports__["default"] = (Component.exports);


/***/ })

});